<template>
	<view class="home">
		<view class="padding-lr-30 bg-shadow bg-ff radius-40">
			<view class="flex padding-tb-30 border-bottom-ed align-center" v-for="item,index in list" :key="index">
				<view class="flex-one">
					<view class="text-32 text-bold">{{item.memo}}</view>
					<view class="margin-top-15 text-24 text-99">{{item.createtime}}</view>
				</view>
				<view class="text-28 text-bold">{{item.op}}{{item.score}}妖币</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				last_page: 0,
				current_page: 1,
			}
		},
		onLoad() {
			this.init()
		},
		onReachBottom() {
			if(this.list!=undefined&&this.list.length>0){
				this.current_page++
				if (this.last_page<this.current_page) {
					return
				}
				this.init()
			}
		},
		methods: {
			init() {
				var that = this
				that.rq.getData('sign/score_log', {
					page:this.current_page
				}).then(res=>{
					if(res.code==1){
						let list = res.data.data
						this.last_page = res.data.last_page;
						this.current_page = res.data.current_page;
						if (this.current_page==1) {
							this.list=list
						} else {
							if(list.length>0){
								this.list=this.list.concat(list)
							}
						}
					}
				})
			}
		}
	}
</script>

<style>
	.home{
		width: 100%;
		min-height: 100vh;
		background: #fff;
		padding: 20rpx 30rpx;
	}
</style>